// 进出管理

import localforage from "localforage"
localforage.config({
  // driver: [localforage.INDEXEDDB],
  name: 'INDEXDB',
  version: "1.0"
})
let type = "inout"
export default {

  /**
   * state 状态 0 所有 1 正在上班 2 以下班
   * outDay 多日未出勤
   * inDay 多日为下班
   * corpID 参建单位
   * teamID 全部班组
   * workerName 人名查询
   */
  async query({ state, outDay, inDay, corpID, teamID, workerName }) {
    let workers = await localforage.getItem(type) || new Map()
    let data = [...workers.values()].filter(item => {
      // console.log(item)
    })
    return data
  },

  async delete(keys) {
    let workers = await localforage.getItem(type) || new Map()
    let a = keys.forEach(item => workers.delete(item))
    return localforage.setItem(type, workers)
  },
}